package com.hps.ssh.controller;

import com.hps.ssh.entity.Student;
import com.hps.ssh.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/student")
public class StudentController {

    @Autowired
    IStudentService studentService;

    @RequestMapping("/add")
    public String add(Model model) {
        Student s = new Student();
        s.setAge(21);
        s.setName("李四");
        s.setSex("男");
        studentService.add(s);
        model.addAttribute("tip", "student add success");
        return "success";
    }
}
